﻿@{
    Layout = "/views/shared/_LayoutInit.cshtml";
}
@section Meta{
    @RenderSection("Meta", false)
    <!-- 继承主母板的Meta，并扩展自己的Meta节点-->
}
@section Head{
    <link href="../../Scripts/JQTree/themes/default/style.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/model.css" rel="stylesheet" />
    <script src="../../Scripts/JQTree/jquery.jstree.js"></script>
    <script src="../../Scripts/My97DatePicker4.7/WdatePicker.js" type="text/javascript"></script>
    <script src="../../Scripts/xheditor/xheditor-zh-cn.min.js" type="text/javascript"></script>
    @RenderSection("Head", false)
    <script type="text/javascript">
        //动态加载JS
        function LoadJS(url) {
            var script;
            script = document.createElement('script');
            script.src = url;
            script.type = 'text/javascript';
            document.getElementsByTagName('head').item(0).appendChild(script);
        }

        $(function () {
            $("table>tbody>tr").filter(":odd").addClass("odd"); //给奇数行添加odd样式
            $(".level3").find("a[href$='@Request.Url.PathAndQuery']").closest("li").addClass("activeSel");//左侧菜单高亮根据URL

            /* 为链接加一个避免事件泡沫的公用方法,目前使用在jqTree的a标签上 */
            $("a").click(function (e) {
                e.stopPropagation()
            });

            if ('@Session["LeftMenuStatus"]' == '' || '@Session["LeftMenuStatus"]' == '0') {
                displayDiv();
            }
            else {
                hiddenDiv();
            }

            $("#left_btn").toggle(function () {
                hiddenDiv();
                $.post("/menu/LeftMenuStatus?flag=1");

            }, function () {
                displayDiv();
                $.post("/menu/LeftMenuStatus?flag=0");
            });

            //标题1和标题的单击显示与隐藏
            $(".level1>a,.level2>a").toggle(function () {
                $(this).next("UL").hide();
            }, function () {
                $(this).next("UL").show();
            });

        });

        //得到高度
        function GetBigHeight(height1, height2) {
            return (height1 > height2 ? height1 : height2) + "px";
        }

        //显示左侧菜单时的
        function displayDiv() {
            $("#left_btn").text("隐藏");
            //$("#main").attr("style", "margin-left:265px;height:" + GetBigHeight($("#main").height(), $(".left").height()));
            //$(".left").attr("style", "display:block;height:" + GetBigHeight($("#main").height(), $(".left").height()));
            $("#main").attr("style", "margin-left:265px")
            $(".left").attr("style", "display:block;");
        }
        //隐藏左侧菜单时的
        function hiddenDiv() {
            $("#left_btn").text("显示");
            //$("#main").attr("style", "margin-left:15px;height:" + GetBigHeight($("#main").height(), $(".left").height()));
            //$(".left").attr("style", "display:none;height:" + GetBigHeight($("#main").height(), $(".left").height()));
            $("#main").attr("style", "margin-left:15px")
            $(".left").attr("style", "display:none;");
        }

    </script>
}
<div class="page">
    <div id="header">
        <div id="title">
            <h1>@(System.Configuration.ConfigurationManager.AppSettings["SystemTitle"] == null ? "Welcome you make CMS,it's author is Gatterr" : System.Configuration.ConfigurationManager.AppSettings["SystemTitle"].ToString())</h1>
        </div>
        <div id="logindisplay">
            @Html.Partial("_LogOnPartial")
        </div>
        <div id="menucontainer">
            @Html.Action("TopMenuTree", "Menu")
        </div>
    </div>
    <div class="left">
        @Html.Action("LeftMenuTree", "Menu")
    </div>
    <div class="leftbtn">
        <a href="javascript:void(0)" id="left_btn" style="text-decoration: none; color: #fff;">隐藏</a>
    </div>
    <div id="main">
        @RenderBody()
    </div>
    <div class="clear">
    </div>
    <div id="footer">
        后台管理系统
    </div>
</div>
